package com.job.client.auth.controller;

import com.job.client.auth.service.RecordService;
import com.job.client.common.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/client/auth/record")
@Slf4j
@Api(tags = "客户端用户记录服务接口")
public class RecordController {
    @Autowired
    private RecordService recordService;

    @GetMapping("/init")
    @ApiOperation("初始化用户记录")
    public ResponseResult initRecord(@RequestParam String userId){
        return recordService.initRecord(userId);
    }
    @PostMapping("/add/posts")
    @ApiOperation("用户对职位感兴趣")
    public ResponseResult addPosts(@RequestParam String userId,@RequestParam String postsId){
        return recordService.addPosts(userId,postsId);
    }
    @PostMapping("/add/company")
    @ApiOperation("用户对公司感兴趣")
    public ResponseResult addCompany(@RequestParam String userId,@RequestParam String companyId){
        return recordService.addCompany(userId,companyId);
    }
    @PostMapping("/add/connect")
    @ApiOperation("用户和发布职位用户聊天")
    public ResponseResult addConnect(@RequestParam String userId,@RequestParam String postsId){
        return recordService.addConnect(userId,postsId);
    }
    @PostMapping("/delete/posts")
    @ApiOperation("用户取消职位感兴趣")
    public ResponseResult deletePosts(@RequestParam String userId,@RequestParam String postsId){
        return recordService.deletePosts(userId,postsId);
    }
    @PostMapping("/delete/company")
    @ApiOperation("用户取消公司感兴趣")
    public ResponseResult deleteCompany(@RequestParam String userId,@RequestParam String companyId){
        return recordService.deleteCompany(userId,companyId);
    }
    @GetMapping("/check/posts")
    @ApiOperation("判断用户是否已经勾选了对职位感兴趣")
    public ResponseResult checkPosts(@RequestParam String userId,@RequestParam String postsId){
        return recordService.checkPosts(userId,postsId);
    }
    @GetMapping("/check/company")
    @ApiOperation("判断用户是否已经勾选了对公司感兴趣")
    public ResponseResult checkCompany(@RequestParam String userId,@RequestParam String companyId){
        return recordService.checkCompany(userId,companyId);
    }

    @GetMapping("/get/posts")
    @ApiOperation("获得用户感兴趣zhiwei全部信息")
    public ResponseResult getPosts(@RequestParam String userId,
                                   @RequestParam Integer page,
                                   @RequestParam Integer size){
        return recordService.getPosts(userId,page,size);
    }
    @GetMapping("/get/company")
    @ApiOperation("获得用户感兴趣公司全部信息")
    public ResponseResult getCompany(@RequestParam String userId,
                                   @RequestParam Integer page,
                                     @RequestParam Integer size){
        return recordService.getCompany(userId,page,size);
    }
    @GetMapping("/get/connect")
    @ApiOperation("获得沟通的全部信息")
    public ResponseResult getConnect(@RequestParam String userId,
                                   @RequestParam Integer page,
                                     @RequestParam Integer size){
        return recordService.getConnect(userId,page,size);
    }
}
